home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
gsdbloo.exe
/
DEMOE003.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-02-24
|
4KB
|
118 lines
program DemoE003;
{------------------------------------------------------------------------------
DBase File Editor
Expanded Sample 3
Demo Program
Copyright (c) Richard F. Griffin
10 February 1992
102 Molded Stone Pl
Warner Robins, GA 31088
-------------------------------------------------------------
Display and edit all record fields on-screen using an index.
This includes the memo field.
********** Not For Use in a TurboVision Environment **********
If it does not already exist, the DEMOE3.DBF file will be created
by using the MakeTestData procedure in GS_GENF.PAS.
All fields in the dBase record will be displayed on-screen using
the FieldDisplay procedure in GS_dBFld_Objt. They can be modified
and stored back to the dBase file using the FieldAccept procedure.
Note that when the index key field LASTNAME is changed, the next
record that displays is the record following the NEW key position.
-------------------------------------------------------------------------------}
uses
CRT,
DOS,
GS_KeyI,
GS_dBFld,
GS_dBase,
GS_FileH,
GS_GenF;
var
MyFile : GS_dBFld_Objt;
CkFile : file;
DumyStr : string;
NewFile : boolean;
procedure DisplayRecord;
begin
MyFile.FieldDisplay('LASTNAME','Last Name: ',1,1);
MyFile.FieldDisplay('FIRSTNAME','First Name, Middle Initial: ',1,2);
MyFile.FieldDisplay('STREET','Street Address: ',1,3);
MyFile.FieldDisplay('OFFICE','Building, suite, etc: ',1,4);
MyFile.FieldDisplay('CITY','City: ',1,5);
MyFile.FieldDisplay('STATE','State: ',1,6);
MyFile.FieldDisplay('ZIP','Zip Code: ',1,7);
MyFile.FieldDisplay('TELEPHONE','Telephone Number: ',1,8);
MyFile.FieldDisplay('BIRTHDATE','Date of Birth: ',1,9);
MyFile.FieldDisplay('PAYMENT','Payment Amount: ',1,10);
MyFile.FieldDisplay('PAIDFLAG','Amount Was Paid?: ',1,11);
MyFile.FieldDisplay('RANDOMNUM','Random Number: ',1,12);
MyFile.FieldDisplay('COMMENTS','Comments: ',1,13);
end;
procedure ModifyRecord;
procedure AcceptRec(FieldName, FieldTitle : string; x, y : integer);
begin
DumyStr := MyFile.FieldAccept(FieldName, FieldTitle, x, y);
if not GS_KeyI_Esc then
MyFile.FieldPut(FieldName,DumyStr);
end;
begin
MyFile.RecChanged := false;
AcceptRec('LASTNAME','Last Name: ',1,1);
if not GS_KeyI_Esc then AcceptRec('FIRSTNAME',
'First Name, Middle Initial: ',1,2);
if not GS_KeyI_Esc then AcceptRec('STREET','Street Address: ',1,3);
if not GS_KeyI_Esc then AcceptRec('OFFICE','Building, suite, etc: ',1,4);
if not GS_KeyI_Esc then AcceptRec('CITY','City: ',1,5);
if not GS_KeyI_Esc then AcceptRec('STATE','State: ',1,6);
if not GS_KeyI_Esc then AcceptRec('ZIP','Zip Code: ',1,7);
if not GS_KeyI_Esc then AcceptRec('TELEPHONE','Telephone Number: ',1,8);
if not GS_KeyI_Esc then AcceptRec('BIRTHDATE','Date of Birth: ',1,9);
if not GS_KeyI_Esc then AcceptRec('PAYMENT','Payment Amount: ',1,10);
if not GS_KeyI_Esc then AcceptRec('PAIDFLAG','Amount Was Paid?: ',1,11);
if not GS_KeyI_Esc then AcceptRec('RANDOMNUM','Random Number: ',1,12);
if not GS_KeyI_Esc then AcceptRec('COMMENTS','Comments: ',1,13);
if (not GS_KeyI_Esc) and (MyFile.RecChanged) then
MyFile.PutRec(MyFile.RecNumber);
end;
begin
ClrScr;
if not GS_FileExists(CkFile,'DEMOE3.DBF') then
begin
writeln('Creating DEMOE3.DBF');
MakeTestData('DEMOE3', 20, true);
writeln('DEMOE3.DBF Created');
NewFile := true;
ClrScr;
end
else NewFile := false;
GotoXY(1,15);
write('Press ESC to stop, any other key to continue');
MyFile.Init('DEMOE3');
MyFile.Open;
if NewFile then MyFile.IndexTo('DEMOE3','LASTNAME');
MyFile.Index('DEMOE3');
MyFile.GetRec(Top_Record);
while (not MyFile.File_EOF) and (not GS_KeyI_Esc) do
begin
DisplayRecord;
ModifyRecord;
MyFile.GetRec(Next_Record);
end;
MyFile.Close;
end.